package collectionexercise;


import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class NewForDemo {
    public static void main(String[] args) {
        String [] array = {"a","b","c","d","e"};
        for (int i = 0; i < array.length; i++) {
            System.out.println(array);
        }
        Collection<String> c = new ArrayList<>();
        c.add("aa");
        c.add("#");
        c.add("bb");
        c.add("#");
        c.add("cc");
        c.add("#");
        c.add("dd");
        c.add("#");
        c.add("ee");
        System.out.println(c);
        System.out.println("-----------");
        Iterator<String> it = c.iterator();
        while (it.hasNext()){
            String str = it.next();
            System.out.println(str);
            if("#".equals(str)){
                it.remove();
            }
        }
        System.out.println("-----------");
        System.out.println(c);


        for (String  srt:array
             ) {
            System.out.println(srt);
        }
        System.out.println("___________");
        for (String  str:c
             ) {
            System.out.println(str);
        }
    }
}
